package easy;

public class Solution_1668 {

    public int maxRepeating(String sequence, String word) {
        int len = sequence.length() / word.length();
        StringBuffer buffer = new StringBuffer();
        int i = 0;
        for (; i < len; i++) {
            buffer.append(word);
            if (!sequence.contains(buffer.toString())) {
                break;
            }
        }
        return i;
    }

    public static void main(String[] args) {
        Solution_1668 model = new Solution_1668();
        System.out.println(model.maxRepeating("ababc", "ab"));
        System.out.println(model.maxRepeating("ababc", "ba"));
    }
}
